<template>
	<view class="type-container">
		<u-navbar bgColor="#fff" :placeholder="true" :fixed="true" @leftClick="$back" title="帮助反馈" titleStyle="{'color': '#000'}">
			
		</u-navbar>
		<view class="type-box">
			<view class="type-item display-flex" v-for="(it,ix) in list" :key="ix"
				@tap="$go('/showcase/user/kefuDetail?id=' + it.id)">
				<image :src=" it.icon | formatImgUrl" class="icon" mode="aspectFit"></image>
				<view class="cont1 display-flex just-between">
					<view class="">
						<view class="name">
							{{it.title_zt}}
						</view>
						<view class="desc">
							{{it.desc}}
						</view>
					</view>
					<image :src="'/images/fapiao_r.png' | formatImgUrl" class="arrow" mode="aspectFit"></image>
				</view>
			</view>
		</view>
		
		<view class="empytView" v-if="list.length<=0">
			<image :src="'/images/kong.png' | formatImgUrl" mode="widthFix" />
		</view>

		<view class="dibu">
			<view class="dili" @click="$go('/showcase/user/feedback')">
				<image :src="'/images/yijian.png' | formatImgUrl" class="dipic" mode=""></image>
				<view class="fatxt">
					意见反馈
				</view>
			</view>
			<view class="borderline">

			</view>
			<view class="dilv" @tap="onPhone">
				<image :src="'/images/zixun.png' | formatImgUrl" class="dipic" mode=""></image>
				<view class="quetxt">
					电话咨询
				</view>
			</view>
		</view>

		<!-- app 电话咨询弹窗 -->
		<u-popup mode="center" :show="show">
			<view class="link-box">
				<view class="link-cont">
					<view class="title">
						电话咨询
					</view>
					<view class="sub-tit">
						请通过以下方式联系我们
					</view>
					<view class="display-flex" @tap="makeCall(info.mobile1)">
						<text class="label">客服热线1：</text>
						<text class="val">{{info.mobile1 || ''}}</text>
					</view>
					<view class="display-flex" @tap="makeCall(info.mobile2)">
						<text class="label">客服热线2：</text>
						<text class="val">{{info.mobile2 || ''}}</text>
					</view>
					<view class="display-flex" @tap="copy(info.email)">
						<text class="label">官方邮箱：</text>
						<text class="val">{{info.email || ''}}</text>
					</view>
					<view class="display-flex" @tap="copy(info.wx_gz)">
						<text class="label">微信公众号：</text>
						<text class="val">{{info.wx_gz || ''}}</text>
					</view>
					<view class="display-flex">
						<text class="label">咨询时间：</text>
						<text class="val" style="color: #3D3D3D;">{{info.consult}}</text>
					</view>
					<view class="tips">
						<view class="">
							更多消息可关注微信公众号了解
						</view>
						<view class="">
							通过微信小程序点击在线咨询可直接与平台客服进行反馈
						</view>
					</view>
				</view>

				<image :src="'/images/close.png' | formatImgUrl" @click="show = false" class="closepic"
					mode="aspectFit"></image>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menu: [{
					icon: '/images/kicon01.png',
					name: '写手大厅',
					desc: '写手评价、团队入驻、橱窗设置、约文须知'
				}, {
					icon: '/images/kicon02.png',
					name: '账号与登录',
					desc: '登陆方式、找回密码、注销账户、修改密码'
				}, {
					icon: '/images/kicon03.png',
					name: '聊天沟通',
					desc: '骚扰举报、屏蔽用户、发起群聊、修改昵称'
				}, {
					icon: '/images/kicon04.png',
					name: '圈子与发布',
					desc: '发布帖子、帖子内容、不良内容、功能介绍'
				}, {
					icon: '/images/kicon05.png',
					name: '订单与支付',
					desc: '优惠使用、开具发票、充值异常、发票说明'
				}, {
					icon: '/images/kicon06.png',
					name: '等级相关',
					desc: '等级说明、保灯机制、会员等级、保灯好处'
				}, {
					icon: '/images/kicon07.png',
					name: '主页设置',
					desc: '我的发布、查询订单、我的资产、更多设置'
				}, {
					icon: '/images/kicon08.png',
					name: '派单问题',
					desc: '寻找写手、如何约稿、如何抢单、抢单建议'
				}],
				show: false,
				list: [],
				page: 1,
				info: {}
			}
		},
		onReachBottom() {
			this.get_list();
		},
		onPullDownRefresh() {
			setTimeout(function() {
				uni.stopPullDownRefresh(); //停止当前页面下拉刷新	
			}, 800);
			this.page = 1;
			this.list = [];
			this.get_list()
		},
		onLoad() {
			this.page = 1;
			this.list = [];
			this.get_list()
			this.getLink()
		},
		methods: {
			getLink(){
				this.$api.default.request('index/linkType', {}).then((res) => {
					if (res.code) {
						console.log(res);
						this.info = res.data
					}
				})
			},
			get_list() {
				var _this = this;
				
				this.$api.default.request('index/getZuti', {
					page: this.page
				}).then((res) => {
					if (res.code) {
			
						if (res.data.data) {
							if (_this.list != null) {
								_this.list = _this.list.concat(res.data.data);
							} else {
								_this.list = res.data.data;
							}
							_this.page++;
						}
					}
				})
			},
			// 电话咨询
			onPhone() {
				// #ifdef MP-WEIXIN
				wx.openCustomerServiceChat({
					extInfo: {
						url: 'https://work.weixin.qq.com/kfid/kfcf6e13cdfaad774ff'
					},
					corpId: 'wwff81ee3e67679806',
					success(res) {},
					fail(err) {
						console.log('err', err)
					}
				})
				// #endif

				// #ifndef MP-WEIXIN
				this.show = true
				// #endif
			},
			// 拨打电话
			makeCall(tel) {
				uni.makePhoneCall({
					phoneNumber: tel
				})
			},
			// 复制内容
			copy(txt) {
				uni.setClipboardData({
					data: txt,
					success: function() {
						console.log('success');
					}
				});

				uni.getClipboardData({
					success: function(res) {
						console.log(res.data);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: rgba(242, 245, 242, 1);
	}

	.type-container {
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		padding-bottom: calc(var(--window-bottom) + 80px);
	}

	.type-box {
		padding: 0 20rpx;
		box-sizing: border-box;
		background-color: #fff;
		box-shadow: 0px 0px 10px 0px rgba(41, 114, 102, 0.15);
		border-radius: 4px;

		.type-item {
			width: 100%;
		}

		.icon {
			width: 48rpx;
			height: 48rpx;
			margin-right: 20rpx;
		}

		.cont1 {
			width: calc(100% - 70rpx);
			padding: 32rpx 0;
			border-bottom: 1px solid #F4F4F4;
		}

		.name {
			font-family: '思源黑体';
			font-size: 14px;
			font-weight: bold;
			color: #3D3D3D;
		}

		.desc {
			margin-top: 8rpx;
			font-family: '思源黑体';
			font-size: 12px;
			color: #999999;
		}

		.arrow {
			width: 40rpx;
			height: 40rpx;
			margin-left: 25rpx;
		}
	}

	.dibu {
		position: fixed;
		background-color: #ffffff;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 100rpx;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.302);
		display: flex;
		align-items: center;
		justify-content: space-around;
		padding-bottom: calc(var(--window-bottom) + 10px);

		.dili {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 330rpx;
			height: 60rpx;
			margin: 0 15rpx;
		}

		.dipic {
			width: 32rpx;
			height: 32rpx;
			margin-right: 16rpx;
		}

		.fatxt,
		.quetxt {
			font-family: Source Han Sans;
			font-size: 14px;
			color: #3D3D3D;
		}

		.borderline {
			width: 1px;
			height: 40rpx;
			background-color: #3D3D3D;
		}

		.dilv {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 330rpx;
			height: 60rpx;
			margin: 0 15rpx;
		}
	}

	.link-box {
		.link-cont {
			width: 280px;
			border-radius: 8px;
			background: #FFFFFF;
			padding: 40rpx 18rpx;
			box-sizing: border-box;
			text-align: center;

			.title {
				font-family: '思源黑体';
				font-size: 16px;
				font-weight: bold;
				color: #3D3D3D;
			}

			.sub-tit {
				margin-top: 6rpx;
				margin-bottom: 30rpx;
				font-family: '思源黑体';
				font-size: 12px;
				color: #999999;
			}

			.display-flex {
				margin-bottom: 26rpx;
				font-family: '思源黑体';
				font-size: 12px;
				color: #3D3D3D;
				justify-content: center;
			}

			.tips {
				font-family: '思源黑体';
				font-size: 10px;
				color: #999999;
			}
			
			.val{
				color: #45C4B0;
			}
		}

		.closepic {
			display: block;
			margin: 0 auto;
			margin-top: 20px;
			width: 24px;
			height: 24px;
		}
	}
</style>